<?php
declare (strict_types = 1);

namespace app\model;

use think\Model;

class BaseModel extends Model
{
    // 自动写入时间戳
    protected $autoWriteTimestamp = true;
    
    // 创建时间字段
    protected $createTime = 'create_time';
    
    // 更新时间字段
    protected $updateTime = 'update_time';
    
    // 软删除字段
    protected $deleteTime = 'delete_time';
    
    // 获取分页数据
    public function getPageList($where = [], $page = 1, $limit = 10)
    {
        $count = $this->where($where)->count();
        $list = $this->where($where)
            ->page($page, $limit)
            ->order('id', 'desc')
            ->select();
            
        return [
            'total' => $count,
            'list' => $list,
            'page' => $page,
            'limit' => $limit
        ];
    }
} 